home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / ASSEMBLE / H145.ZIP / ASXXXX_3.ZIP / README.ASM < prev    next >
Assembly Source File  |  1990-07-18  |  5KB  |  184 lines

  1.     ;      This file contains typical console input and
  2.     ;    output routines you must write, assemble and link with
  3.     ;    MOND09 or AST09.
  4.  
  5.     .title    Option File for Monitor - 09
  6.  
  7.     .module    monopt
  8.  
  9.     .area    OPTFUN    (ABS,OVR)
  10.  
  11.     .sbttl    MONDEB - 09 Startup Entry Points
  12.  
  13. mond09:    ldd    #typswi        ; check if settup
  14.     cmpd    exswi
  15.     bne    1$
  16.     swi            ; trap into MOND09
  17.     rts
  18.  
  19. 1$:    ldd    #typswi
  20.     std    exswi        ; swi interrupt vector
  21.     ldd    #dspidta
  22.     std    conin
  23.     std    altin
  24.     ldd    #dspodta
  25.     std    conout
  26.     std    altout
  27.     jsr    mond09        ; start up MONDEB - 09
  28.     rts
  29.  
  30.  
  31.     ;********************************************************
  32.     ;*      typical console i/o drivers
  33.     ;********************************************************
  34.  
  35.     ;* dspidta - return console input character
  36.     ;* output: c=0 if no data ready, c=1 a=character
  37.  
  38. dspidta:
  39.     tst    rcvrcsr        ; a character ?
  40.     bmi    1$        ; yes - skip
  41.     clc            ; no character
  42.     rts            ; return to caller
  43.  
  44. 1$:    lda    rcvrdata    ; get character
  45.     cmpa    #0o141        ; translate lower to upper
  46.     bcs    2$
  47.     cmpa    #0o173
  48.     bcc    2$
  49.     suba    #0o40
  50. 2$:    sec            ; character taken
  51.     rts
  52.  
  53.     ;* dspodta - output character to console device
  54.     ;* input: a=character to send
  55.     ;* all registers transparent
  56.  
  57. dspodta:
  58.     tst    xmtrcsr        ; transmitter ready ?
  59.     bpl    dspodta        ; no - loop until ready
  60.     sta    xmtrdata    ; send character
  61.     rts
  62.  
  63.  
  64.  
  65.     .title    Option File for Assist09
  66.  
  67.     .module    astopt
  68.  
  69.     .page
  70.     .sbttl    Assist09 SWI Functions
  71.  
  72.     ;********************************************************
  73.     ;* assist09 monitor swi functions
  74.     ;*
  75.     ;*  the following equates define functions provided
  76.     ;*  by the assist09 monitor via the swi instruction.
  77.     ;********************************************************
  78.  
  79. inchnp    =    0        ; input char in a reg - no parity
  80. outch    =    1        ; output char from a reg
  81. pdata1    =    2        ; output string
  82. pdata    =    3        ; output cr/lf then string
  83. out2hs    =    4        ; output two hex and space
  84. out4hs    =    5        ; output four hex and space
  85. pcrlf    =    6        ; output cr/lf
  86. space    =    7        ; output a space
  87. monitr    =    8        ; enter assist09 monitor
  88. vctrsw    =    9        ; vector examine/switch
  89. brkpt    =    10        ; user program breakpoint
  90. pause    =    11        ; task pause function
  91. numfun    =    11        ; number of available functions
  92.  
  93.     ;* sub-codes for accessing the vector table.
  94.     ;* they are equivalent to offsets in the table.
  95.     ;* relative positioning must be maintained.
  96.  
  97. .avtbl    =    0        ; address of vector table
  98. .cmdl1    =    2        ; first command list
  99. .rsvd    =    4        ; reserved hardware vector
  100. .swi3    =    6        ; swi3 routine
  101. .swi2    =    8        ; swi2 routine
  102. .firq    =    10        ; firq routine
  103. .irq    =    12        ; irq routine
  104. .swi    =    14        ; swi routine
  105. .nmi    =    16        ; nmi routine
  106. .reset    =    18        ; reset routine
  107. .cion    =    20        ; console on
  108. .cidta    =    22        ; console input data
  109. .cioff    =    24        ; console input off
  110. .coon    =    26        ; console output on
  111. .codta    =    28        ; console output data
  112. .cooff    =    30        ; console output off
  113. .hsdta    =    32        ; high speed printdata
  114. .bson    =    34        ; punch/load on
  115. .bsdta    =    36        ; punch/load data
  116. .bsoff    =    38        ; punch/load off
  117. .pause    =    40        ; task pause routine
  118. .expan    =    42        ; expression analyzer
  119. .cmdl2    =    44        ; second command list
  120. .pad    =    46        ; character pad and new line pad
  121. .echo    =    48        ; echo/load and null bkpt flag
  122.  
  123.  
  124.     .sbttl    Assist09 Startup Entry Points
  125.  
  126. ast09:    ldd    exswi        ; verify settup
  127.     cmpd    #swi
  128.     bne    1$
  129.     lda    #1
  130.     swi            ; reenter monitor
  131.     .byte    monitr
  132.     pshs    cc
  133.     orcc    #120        ; inhibit interrupts
  134.     puls    cc,pc        ; return to caller
  135.  
  136. 1$:    ldd    #swi        ; load swi vector
  137.     std    exswi
  138.     leas    astack,pcr    ; stack pointer
  139.     jsr    bldvtr        ; build vector table
  140.     ldd    #dspidta    ; console input
  141.     std    .cidta,u    ; load vector table
  142.     ldd    #dspodta    ; console output
  143.     std    .codta,u    ; load vector table
  144.     clra            ; announce
  145.     swi            ; monitor fireup
  146.     .byte    monitr        ; to enter command processing
  147.     pshs    cc
  148.     orcc    #120        ; inhibit interrupts
  149.     jmp    main        ; restart caller
  150.  
  151.  
  152.     ;********************************************************
  153.     ;*      typical i/o drivers
  154.     ;********************************************************
  155.  
  156.     ;* dspidta - return console input character
  157.     ;* output: c=0 if no data ready, c=1 a=character
  158.  
  159. dspidta:
  160.     tst    rcvrcsr        ; a character ?
  161.     bmi    1$        ; yes - skip
  162.     clc            ; no character
  163.     rts            ; return to caller
  164.  
  165. 1$:    lda    rcvrdata    ; get character
  166.     cmpa    #0o141        ; translate lower to upper
  167.     bcs    2$
  168.     cmpa    #0o173
  169.     bcc    2$
  170.     suba    #0o40
  171. 2$:    sec            ; character taken
  172.     rts
  173.  
  174.     ;* dspodta - output character to console device
  175.     ;* input: a=character to send
  176.     ;* all registers transparent
  177.  
  178. dspodta:
  179.     tst    xmtrcsr        ; transmitter ready ?
  180.     bpl    dspodta        ; no - loop until ready
  181.     sta    xmtrdata    ; send character
  182.     rts
  183.  
  184.